package com.auroramanito.uaa.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

//mooc.jwt.access
@Configuration
@ConfigurationProperties(prefix = "auroramanito")
public class AppProperties {

    @Getter
    @Setter
    private Jwt jwt = new Jwt();


    @Getter
    @Setter
    private Ali ali = new Ali();

    @Getter
    @Setter
    private SmsProvider smsProvider = new SmsProvider();

    @Getter
    @Setter
    private EmailProvider emailProvider = new EmailProvider();

    @Getter
    @Setter
    private LeanCloud leanCloud = new LeanCloud();



    /**
     * 选择信息服务提供方
     * */
    @Getter
    @Setter
    public static class SmsProvider{
        //信息提供方名称
        private String name;
        //访问地址
        private String apiUrl;
    }

    /**
     * 选择信息服务提供方
     * */
    @Getter
    @Setter
    public static class EmailProvider{
        private String name;
        private String apiKey;
    }



    /**
     *  配置AliConfig  提供阿里云的apiKey和apiSecret;
     * */
    @Getter
    @Setter
    public static class Ali{
        private String apiKey;
        private String apiSecret;
    }


    @Getter
    @Setter
    public static class LeanCloud{
        private String appId;
        private String appKey;
    }
    @Getter
    @Setter
    public static class Jwt{
        private String header = "Authorization";
        private String prefix = "Bearer";

        //Access TOKEN 过期时间
        private Long accessTokenExpireTime = 1000*60*60L;

        //refresh 过期时间
        private Long refreshTokenExpireTime = 30 * 24 *3600 *1800L;
    }
}
